package com.xxdemo.quickstart;

import java.io.Serializable;

public class CustomerDto implements Serializable {
    private Long id;
    private String name;
    private String dob;
    private String address;

    public CustomerDto(Long id, String name, String dob, String address) {
        this();
        this.id = id;
        this.name = name;
        this.dob = dob;
        this.address = address;
    }

    /// 浅拷贝
    public CustomerDto(CustomerDto that) {
        this();
        this.id = that.id;
        this.name = that.name;
        this.dob = that.dob;
        this.address = that.address;
    }

    /// 默认构造函数
    public CustomerDto() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDob() {
        return dob;
    }

    public void setDob(String dob) {
        this.dob = dob;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * CustomerDto dto = CustomerDto.of(originCustomer);
     *
     * @param origin 原始Customer客户档案建模
     * @return 生成的新DTO结构体
     */
    public static CustomerDto of(Customer origin) {
        return CustomerDtoCopier.INSTANCE.copyFrom(origin);
    }
}
